#ifndef GATE_MODULE_IMPL_H
#define GATE_MODULE_IMPL_H

#include "gate_module.h"
#include <list>

namespace utility
{
namespace network
{
class gate_listener_impl;
class gate_connector_impl;
class gate_module_impl : public gate_module
{
    typedef std::list<gate_listener_impl *> gate_listener_container;

    typedef std::list<gate_connector_impl *> gate_connector_container;
public:
    // singleton
    static gate_module_impl * instance();

    // release singleton
    static void destroy_instance();
public:
    // initialize
    virtual bool initialize(net_module * );

    // create the gate listener
    virtual gate_listener * create_listener();

    // create the connector
    virtual gate_connector * create_connector();

protected:
    // standard constructor
    gate_module_impl(void);

    // standard destructor
    ~gate_module_impl(void);

private:
    // singleton instance
    static gate_module_impl * instance_;

    // network module
    net_module * net_module_;

    gate_listener_container listeners_;

    gate_connector_container connectors_;

    
};

} // namespace of ::utility::network
} // namespace of ::utility

utility::network::gate_module * get_gate_module();
void destroy_gate_module();

#endif // endif of GATE_MODULE_IMPL_H
